package de.schiess.main;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;

import model.Card;



public class SuperNovaCrawler implements Runnable {
	private SupernovaCardExtractor snce;
	private Date date;
	private HashMap<Date, ArrayList<Card>> map;
	private Thread thread;

	public SuperNovaCrawler(HashMap<Date, ArrayList<Card>> inMap) {
		snce = new SupernovaCardExtractor();
		date = new Date();
		map = inMap;
	}

	@Override
	public void run() {
		while (true) {
			date = new Date();
			map.put(date, snce.getCards(date));
			System.out.println(date + ": Map updated!");
			try {
				thread.sleep(3600000);
			} catch (InterruptedException e) {
				e.printStackTrace();
				break;
			}
		}
	}

}
